import request from "@/axios/request";
import url from "@/axios/url";
const { mesUrl,adminUrl  } = url();
// 导出url
export const exportUrl = `${mesUrl}mesProcess/export`;
// 导出url
export const exportCellUrl = `${mesUrl}mesProcess/exportCell`;
// 分页查询
export function getList(params = {}) {
  return request({
    url: `${mesUrl}mesProcess`,
    method: "get",
    params,
  });
}
// 新增
export function rowCreate(data = {}) {
  return request({
    url: `${mesUrl}mesProcess`,
    method: "post",
    data,
  });
}
// 修改
export function rowUpdate(data = {}) {
  return request({
    url: `${mesUrl}mesProcess`,
    method: "put",
    data,
  });
}
// 删除
export function rowDel(id) {
  return request({
    url: `${mesUrl}mesProcess/${id}`,
    method: "put",
  });
}
// 详情
export function rowDetail(id) {
  return request({
    url: `${mesUrl}mesProcess/info/${id}`,
    method: "get",
  });
}

// 查询标准工序分类列表
export function getProcessTypeIdList() {
  return request({
    url: `${mesUrl}mesProcessType/list`,
    method: "get",
  });
}

// 查询工序属性：过站（默认）、检验、返修列表
export function getProcessPropertyList() {
  return request({
    url: `${adminUrl}dict/type/process_property`,
    method: "get",
  });
}
// 查询检验、返修：下一工序编码列表
export function getNextCellCodeList(params = {}) {
  return request({
    url: `${mesUrl}mesProcess/list`,
    method: "get",
    params,
  });
}
// 返修后流程
export function getRepairFlowFlag() {
  return request({
    url: `${adminUrl}dict/type/after_repair`,
    method: "get",
  });
}
// 是否委外工序
export function getYesOrNotList() {
  return request({
    url: `${adminUrl}dict/type/yes_or_not`,
    method: "get",
  });
}
// 启用或停用
export function getActiveStatusList() {
  return request({
    url: `${adminUrl}dict/type/active_status`,
    method: "get",
  });
}

// 获取工位列表
export function getCellList() {
  return request({
    url: `${adminUrl}baseFactoryModeling/select?level=6`,
    method: "get",
  });
}

// 获取工序 - 工位关系
export function getCellListByCode(processCode) {
  return request({
    url: `${mesUrl}mesProcessCell/getListByCode/${processCode}`,
    method: "get",
  });
}
// 保存 工序 - 工位关系
export function addProcessCell(data = {}) {
  return request({
    url: `${mesUrl}mesProcessCell/addProcessCell`,
    method: "post",
    data,
  });
}

// 查询线体列表
export function getLineCodeList(params = {}) {
  return request({
    url: `${adminUrl}baseFactoryModeling/children`,
    method: "get",
    params,
  });
}

// 查询线体查询工位
export function getstationsByLineCode(params = {}) {
  return request({
    url: `${adminUrl}baseFactoryModeling/children`,
    method: "get",
    params,
  });
}

// 是否委外工序
export function getReportModelList() {
  return request({
    url: `${adminUrl}dict/type/mes_report_model`,
    method: "get",
  });
}

export function baseFactoryModeling(data) {
  return request({
    url: `${adminUrl}baseFactoryModeling/children`,
    method: "get",
    params: data,
  });
}
// 查询线体编码列表
export function getLineCodeListNew(params) {
  return request({
    url: `${adminUrl}baseFactoryModeling/children`,
    method: "get",
    params,
  });
}
// 根据型号或系列号获取工艺列表(包含默认列表)
export function saveProcessDetail(data = {}) {
  console.log(data, 3);
  return request({
    url: `${mesUrl}mesTechnologyProcess/saveProcessDetail`,
    method: "post",
    data,
  });
}

// 详情
export function getProcessDetail(params) {
  return request({
    url: `${mesUrl}mesTechnologyProcess/info`,
    method: "get",
    params,
  });
}

// 根据工序获取已分配工位信息
export function getListByProcess(params) {
  return request({
    url: `${mesUrl}mesProcessCell/getListByProcess`,
    method: "get",
    params,
  });
}

// 获取工序列表
export function getProcessList(params) {
  return request({
    url: `${mesUrl}mesProcess`,
    method: "GET",
    params,
  });
}

